﻿@using System.Web.Optimization
@using TestApplication.WebUI.Helpers
@model IEnumerable<TestApplication.Domain.Models.Store>

@{
    ViewBag.Title = "Index";
}

<h2>Index</h2>

<div data-ng-controller="AppCtrl">
    <table class="table">
        <tr>
            <th>
                @Html.DisplayNameFor(model => model.Title)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.Address)
            </th>
            <th>
                @Html.DisplayNameFor(model => model.WorkingHours)
            </th>
            <th></th>
        </tr>

        @foreach (var item in Model)
        {
            <tr>
                <td>
                    @Html.DisplayFor(modelItem => item.Title)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.Address)
                </td>
                <td>
                    @Html.DisplayFor(modelItem => item.WorkingHours)
                </td>
                <td>
                    @Html.ActionLink(
                        "Show Products",
                        "ProductList",
                        "Stores",
                        new { storeId = item.Id },
                        new
                        {
                            data_api_url = @Url.ApiUrl("stores"),
                            data_ng_click = "setActiveLink($event)"
                        })
                </td>




            </tr>
        }

    </table>
</div>

<div ng-view></div>

@section Scripts {
    @Scripts.Render("~/bundles/angular", "~/bundles/angular-app")
}